<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs v-model="currSel">
          <el-tab-pane name="account" label="登录账户设置">
            <!-- 账户设置 -->
            <LoginSetting :user-detail="userDetail" />
          </el-tab-pane>
          <el-tab-pane name="detail" label="个人详情">
            <!-- 个人详情 => 头像上传（上云） -->
            <UserInfo :user-detail="userDetail" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
import LoginSetting from './components/login-setting.vue'
import UserInfo from './components/user-info.vue'
import { getUserDetailById } from '@/api/user.js'

export default {
  components: {
    LoginSetting,
    UserInfo
  },
  data () {
    return {
      // 员工详情数据
      userDetail: {},
      // 当前选中的页签，一进到页面默认显示的页面为detail
      currSel: 'detail'
    }
  },
  created () {
    this.getUserDetail()
  },
  methods: {
    async getUserDetail () {
      // 获取动态路由参数 console.log(this.$route.params)
      const detail = await getUserDetailById(this.$route.params.id)
      // console.log(detail)
      this.userDetail = detail
    }
  }
}
</script>

<style lang=" scss" scoped>
</style>
